<?php

class BinaryTreeNode 
{
	private $_leftChild;
	private $_rightChild;
	protected $_value;
	
    public function __construct($value) 
    {
    	$this->_value = $value;
    }
    
    public function setLeft($left)
    {
    	$this->_leftChild = $left;
    }
    
    public function setRight($right)
    {
    	$this->_rightChild = $right;
    }
    
    public function &getLeft()
    {
    	return $this->_leftChild;
    }
    
    public function &getRight()
    {
    	return $this->_rightChild;
    }
    
    public function setValue($value)
    {
    	$this->_value = $value;
    }
    
    public function getValue()
    {
    	return $this->_value;
    }  
    
    public function isLeaf()
    {
    	return !isset($this->_leftChild) && !isset($this->_rightChild);
    }  
}
?>